import time, os
import sys
sys.path.append('./test_case')

import unittest
from HTMLTestRunner import HTMLTestRunner

test_dir = './test_case'

file = unittest.defaultTestLoader.discover(test_dir, pattern='test_*.py')
print file
print type(file)

if __name__ == '__main__':
    now = time.strftime("%Y-%m-%d %H-%M-%S", time.localtime(time.time()))
    public_path = os.path.dirname(os.path.abspath(sys.argv[0]))
    filename = public_path + "\\Result\\" + now + "report.html"
    fp = open(filename, 'wb')
    runner = HTMLTestRunner(stream=fp,
                            title="tet",
                            description="test12"
                            )
    runner.run(file)
    fp.close()